package com.itheima.d3_abstract;

public class Test3 {
    public static void main(String[] args) {
        String name = "abc";
        OnlyPay zf = null;
        if ("abc".equals(name)) {
            zf = new abcPay();
        } else if ("wx".equals(name)) {
            zf = new Wx();
        }
        zf.pay(100);
    }
}

abstract class OnlyPay {
    public abstract void pay(double money);
}

class abcPay extends OnlyPay {

    @Override
    public void pay(double money) {
        System.out.println("农行支付");
    }
}

class Wx extends OnlyPay {
    @Override
    public void pay(double money) {
        System.out.println("微信支付");
    }
}